package spring.logger;

import java.io.IOException;
import java.lang.reflect.Method;

import org.apache.log4j.Logger;
import org.springframework.aop.ThrowsAdvice;

public class ThrowingLogger implements ThrowsAdvice {
	private Logger logger=Logger.getLogger(ThrowingLogger.class);
	
	public void afterThrowing(Method method, Object[] args, Object target,IOException e) throws Throwable{
		logger.error("IO方法执行异常:"+e);
	}
	public void afterThrowing(Method method, Object[] args, Object target,RuntimeException e) throws Throwable{
		logger.error("运行时方法执行异常:"+e);
	}
}
